

#ifndef xdtls_srtp_hpp
#define xdtls_srtp_hpp

#ifdef __cplusplus
extern "C" {
#endif
    
typedef struct xdtls_srtp_st * xdtls_srtp_t;

/*! \brief DTLS roles */
typedef enum xdtls_role {
    XDTLS_ROLE_ACTPASS = -1,
    XDTLS_ROLE_SERVER,
    XDTLS_ROLE_CLIENT,
} xdtls_role;

#define XDTLS_HASH_SHA1     "sha-1"
#define XDTLS_HASH_SHA224   "sha-224"
#define XDTLS_HASH_SHA256   "sha-256"
#define XDTLS_HASH_SHA384   "sha-384"
#define XDTLS_HASH_SHA512   "sha-512"
    

typedef int (*xdtls_srtp_send_func_t)(xdtls_srtp_t dtls, void * cb_context, const unsigned char * data, int length);

int xdtls_srtp_init(const char *pem_file, const char *key_file);
void xdtls_srtp_exit();
xdtls_srtp_t xdtls_srtp_create(const char *pem_file, const char *key_file, const char * hash_name, xdtls_role role, xdtls_srtp_send_func_t send_func, void * cb_context);
void xdtls_srtp_destroy(xdtls_srtp_t dtls);
const char * xdtls_srtp_get_id(xdtls_srtp_t dtls);
const char * xdtls_srtp_get_local_fingerprint_str(xdtls_srtp_t dtls);
int xdtls_srtp_start_handshake(xdtls_srtp_t dtls, int is_force);
int xdtls_srtp_input_data(xdtls_srtp_t dtls, const unsigned char * buf, int len, int * psetup);
int xdtls_srtp_is_ready(xdtls_srtp_t dtls);
int xdtls_srtp_protect(xdtls_srtp_t dtls, unsigned char * buf, int len);
int xdtls_srtp_protect_rtcp(xdtls_srtp_t dtls, unsigned char * buf, int len);
int xdtls_srtp_unprotect(xdtls_srtp_t dtls, unsigned char * buf, int len);
int xdtls_srtp_unprotect_rtcp(xdtls_srtp_t dtls, unsigned char * buf, int len);
int xdtls_srtp_get_keys(xdtls_srtp_t dtls, unsigned char ** plocal, int * plocal_len, unsigned char ** premote, int *premote_len);
int xdtls_srtp_set_keys(xdtls_srtp_t dtls, unsigned char * local, int local_len, unsigned char * remote, int remote_len);
int xdtls_srtp_set_remote_fingerprint_str(xdtls_srtp_t dtls, const char * hash_name, const char * fingerprint_str);
int xdtls_srtp_check_timeout(xdtls_srtp_t dtls, int64_t * ptimeout_value);
    
#ifdef __cplusplus
}
#endif
        
#endif /* xdtls_srtp_hpp */
